﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebEntities.Models.WebInfo
{
    public enum NewsStatusMode { Show = 1, Hide }
    public enum NewsImportant { Normal = 1, Important }

    public class News
    {
        public int NewsID { get; set; }
        public string NewsTitle { get; set; }
        public string SubTitle { get; set; }
        public int? NewsType { get; set; }
        public string NewsTypeName { get; set; }
        public string Keywords { get; set; }
        public string Description { get; set; }
        public int? CataID { get; set; }
        public string CataName { get; set; }
        public DateTime CreateTime { get; set; }
        public string Creator { get; set; }
        public DateTime? PubTime { get; set; }
        public string Publisher { get; set; }
        public int? SortNum { get; set; }
        public int? ViewCount { get; set; }
        public string NewsCover { get; set; }
        public DateTime? LastUpdated { get; set; }
        public int? NewsStatus { get; set; }
        public string NewsFile { get; set; }
        public string FileTitle { get; set; }
        public byte? Important { get; set; }
        public string NewsSrc { get; set; }

        public static News AsNews(WI_News winews, string cataName, string ntypeName)
        {
            News news = new News
            {
                NewsID = winews.NewsID,
                NewsTitle = winews.NewsTitle,
                SubTitle = winews.SubTitle,
                NewsType = winews.NewsType,
                NewsTypeName = ntypeName,
                Keywords = winews.Keywords,
                Description = winews.Description,
                CataID = winews.CataID,
                CataName = cataName,
                CreateTime = winews.CreateTime,
                Creator = winews.Creator,
                PubTime = winews.PubTime,
                Publisher = winews.Publisher,
                SortNum = winews.SortNum,
                ViewCount = winews.ViewCount,
                NewsCover = winews.NewsCover,
                LastUpdated = winews.LastUpdated,
                NewsStatus = winews.NewsStatus,
                NewsFile = winews.NewsFile,
                FileTitle = winews.FileTitle,
                Important = winews.Important,
                NewsSrc = winews.NewsSrc
            };
            return news;
        }
    }
}
